/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ServicesAccessData;

import DAO.Memcached;
import java.io.IOException;
import org.apache.cassandra.thrift.InvalidRequestException;
import org.apache.cassandra.thrift.UnavailableException;
import org.apache.thrift.server.TNonblockingServer;
import org.apache.thrift.server.TServer;
import org.apache.thrift.transport.TNonblockingServerSocket;
import org.apache.thrift.transport.TNonblockingServerTransport;
import org.apache.thrift.transport.TTransportException;


public class NonblockingServerUser {
    private void start() throws InvalidRequestException, UnavailableException {
        try {
            TNonblockingServerTransport serverTransport = new TNonblockingServerSocket(7911);
            User.Processor processor = new User.Processor(new UserImpl());

            TServer server = new TNonblockingServer(new TNonblockingServer.Args(serverTransport).processor(processor));            
            
            System.out.println("Starting server on port 7911 ...");
            server.serve();
        } catch (TTransportException e) {
        }
    }

    public static void main(String[] args) throws InvalidRequestException, IOException, UnavailableException {
        NonblockingServerUser srv = new NonblockingServerUser();
        Memcached.run();
        srv.start();
    }
}